<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>后台登录</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="/Woniu/Public/X-admin/favicon.ico" type="image/x-icon" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/Woniu/Public/X-admin/css/x-admin.css" media="all">
        <link rel="stylesheet" href="/Woniu/Public/X-admin/bs/css/bootstrap.min.css">
        <script src="/Woniu/Public/X-admin/bs/js/jquery.min.js"></script>
        <script src="/Woniu/Public/X-admin/bs/js/bootstrap.min.js"></script>
        <script src="/Woniu/Public/X-admin/bs/js/holder.min.js"></script>
    </head>
    
    <body style="background-color: #393D49">
        <div class="x-box">
            <div class="x-top">
                <i class="layui-icon x-login-close" style="color:#6F3C04">
                    <b>Admin Login !</b>
                </i>
                <ul class="x-login-right">
                    <li style="background-color: #F1C85F;" color="#F1C85F">
                    </li>
                    <li style="background-color: #EA569A;" color="#EA569A">
                    </li>
                    <li style="background-color: #393D49;" color="#393D49">
                    </li>
                </ul>
            </div>
            <div class="x-mid">
                <div class="x-avtar" style="height:80px;">
                    <img src="/Woniu/Public/X-admin/images/aaa.jpg" alt="" style="width:80px;height:80px">
                </div>
                <div class="input">
                    <form class="form-horizontal" role="form" action="/Woniu/index.php/Home/Login/login" method="post">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-2 control-label">
                                <span class="glyphicon glyphicon-user"></span>
                            </label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="name" placeholder="username" name="name">
                        </div>
                        <span style="font-size: 12px" id="username"></span>
                        </div>

                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">
                                <span class="glyphicon glyphicon-lock"></span>
                            </label>
                        <div class="col-sm-6">
                            <input type="password" class="form-control" id="pass" placeholder="password" name="password">
                        </div>
                        <span style="font-size: 12px" id="password"></span>
                        </div>

                        <div class="form-group">
                            <label for="inputVerify" class="col-sm-2 control-label">
                                <span class="glyphicon glyphicon-pencil"></span>
                            </label>
                        <div class="col-sm-3">
                            <img class="verifyimg reloadverify" alt="点击切换" src="/Woniu/index.php/Home/Login/verify" onclick="this.src=this.src+='?'+Math.random()">
                        </div>
                      </div>

                      <div class="form-group">
                            <label for="inputVerify" class="col-sm-2 control-label">
                                <!-- <span class="glyphicon glyphicon-pencil"></span> -->
                            </label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="inputVerify" placeholder="验证码" name="verify">
                        </div>
                        <span style="font-size: 12px" id="verify"></span>
                      </div>

                      <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10 ">
                          <button type="submit" class="btn btn-default col-sm-6">登 录</button>
                        </div>
                      </div>
                    </form>
                    <a title="忘记密码" href="javascript:;" onclick="admin_edit('忘记密码','/Woniu/index.php/Home/Login/forget','4','','500')" class="col-sm-3 control-label col-sm-offset-8" style="text-decoration:none">忘记密码?</a>
                </div>
            </div>
        </div>
        <p style="color:#fff;text-align: center;">Copyright © 2017.Company name All rights X-admin </p>
        <script src="/Woniu/Public/X-admin/lib/layui/layui.js" charset="utf-8"></script>
        <script src="/Woniu/Public/X-admin/js/x-layui.js" charset="utf-8"></script>
        <!-- <script src="/Woniu/Public/X-admin/js/jquery.min.js" charset="utf-8"></script> -->
            
        <script>

             layui.use(['laydate','element','laypage','layer','form'], function(){
                $ = layui.jquery;//jquery
              laydate = layui.laydate;//日期插件
              lement = layui.element();//面包导航
              laypage = layui.laypage;//分页
              layer = layui.layer;//弹出层
              form = layui.form();     

              //以上模块根据需要引入
              laypage({
                cont: 'page'
                ,pages: 100
                ,first: 1
                ,last: 100
                ,prev: '<em><</em>'
                ,next: '<em>></em>'
              }); 
              
            });
            //编辑
            function admin_edit (title,url,id,w,h) {
                x_admin_show(title,url,w,h); 
                // alert("aa");
            }
            </script>
        
        <script>
        flag=1;
        flags=1;
        flagss=1;
            layui.use(['form'],
            function() {
                $ = layui.jquery;
                var form = layui.form(),
                layer = layui.layer;

                $('.x-login-right li').click(function(event) {
                    color = $(this).attr('color');
                    $('body').css('background-color', color);
                });
            });

            $("#name").focus(function(){
                $("#username").html("*请输入您的用户名!");
                $("#username").css('color','#666');
                flag=1;
            }).blur(function(){
                vv=$(this).val();
                if(vv==''){
                    $("#username").html("*用户名不能为空!");
                    $("#username").css('color','red');
                }else{
                    // if(vv==null){
                    //     $("#username").html("*用户名为4~18位字符!");
                    //     $("#username").css('color','red');
                    // }else{
                        $.get('/Woniu/index.php/Home/Login/find',{name:vv},function(data){
                            // alert(data);
                            // 判断是否被禁用
                            if(data == "禁用"){
                                $("#username").html("* 此用户名已被禁用!");
                                $("#username").css('color','red');
                            }else{
                                // 判断是否存在
                                if(data == '用户不存在'){
                                    $("#username").html("* 此用户名不存在!");
                                    $("#username").css('color','red');
                                }else{
                                    $("#username").html("* 此用户名可以登陆 ^v^");
                                    $("#username").css('color','green');
                                    flag=0;
                                }
                            }
                        });
                    // }
                }
            });

            $("#pass").focus(function(){
                $("#password").html("*请输入您的密码!");
                $("#password").css('color','#666');
                flags=1;
            }).blur(function(){
                pp=$(this).val();
                // alert(pp);
                if(pp==''){
                    $("#password").html("*密码不能为空!");
                    $("#password").css('color','red');
                }else{
                    if(pp.match(/^\w{6,18}$/)==null){
                        $("#password").html("*密码为6~18位字符!");
                        $("#password").css('color','red');
                    }else{
                        $("#password").html("* 密码格式正确 ^v^");
                        $("#password").css('color','green');
                        flags=0;
                    }
                }
            });

            $("#inputVerify").focus(function(){
                $("#verify").html("*请输入您看到的字符!");
                $("#verify").css('color','#666');
                flagss=1;
            }).blur(function(){
                yy=$(this).val();
                if(yy==''){
                    $("#verify").html("*验证码不能为空!");
                    $("#verify").css('color','red');
                }else{
                    $.post('/Woniu/index.php/Home/Login/yzm',{verifys:yy},function(data){
                        // alert(data);
                        if(data==1){
                            $("#verify").html("* 验证码输入正确 ^v^");
                            $("#verify").css('color','green');
                            flagss=0;
                        }else{
                            $("#verify").html("* 验证码输入有误!");
                            $("#verify").css('color','red');
                        }
                    });
                }
            });

            $("form").submit(function(){
                if(flag==1 || flags==1 || flagss==1){
                    alert('输入信息不正确拒绝登录');
                    return false;//阻止表单提交
                }
            })
            function reload(){
                location.replace(location.href);
            }
        </script>
    </body>

</html>